package com.qj.yantaishan.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qj.yantaishan.common.core.text.Convert;
import com.qj.yantaishan.domain.ShanglalaProduct;
import com.qj.yantaishan.mapper.ShanglalaProductMapper;
import com.qj.yantaishan.service.IShanglalaProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品Service业务层处理
 *
 * @author qihe
 * @date 2022-07-25
 */
@Service
@Primary
public class ShanglalaProductServiceImpl    extends ServiceImpl<ShanglalaProductMapper, ShanglalaProduct>  implements IShanglalaProductService
{
    @Autowired
    private ShanglalaProductMapper shanglalaProductMapper;

    /**
     * 查询商品
     *
     * @param productId 商品主键
     * @return 商品
     */
    @Override
    public ShanglalaProduct selectShanglalaProductByProductId(Integer productId)
    {
        return shanglalaProductMapper.selectShanglalaProductByProductId(productId);
    }

    /**
     * 查询商品列表
     *
     * @param shanglalaProduct 商品
     * @return 商品
     */
    @Override
    public List<ShanglalaProduct> selectShanglalaProductList(ShanglalaProduct shanglalaProduct)
    {
        return shanglalaProductMapper.selectShanglalaProductList(shanglalaProduct);
    }

    /**
     * 新增商品
     *
     * @param shanglalaProduct 商品
     * @return 结果
     */
    @Override
    public int insertShanglalaProduct(ShanglalaProduct shanglalaProduct)
    {
        return shanglalaProductMapper.insertShanglalaProduct(shanglalaProduct);
    }

    /**
     * 修改商品
     *
     * @param shanglalaProduct 商品
     * @return 结果
     */
    @Override
    public int updateShanglalaProduct(ShanglalaProduct shanglalaProduct)
    {
        return shanglalaProductMapper.updateShanglalaProduct(shanglalaProduct);
    }

    /**
     * 批量删除商品
     *
     * @param productIds 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int deleteShanglalaProductByProductIds(String productIds)
    {
        return shanglalaProductMapper.deleteShanglalaProductByProductIds(Convert.toStrArray(productIds));
    }

    /**
     * 删除商品信息
     *
     * @param productId 商品主键
     * @return 结果
     */
    @Override
    public int deleteShanglalaProductByProductId(Integer productId)
    {
        return shanglalaProductMapper.deleteShanglalaProductByProductId(productId);
    }
}
